using UnityEditor;

namespace QFramework.Framework.ResKit.Editor
{
    public static class SimulationModeMenu
    {
        private const string SimulationModePath = "QFramework/Framework/ResKit/Simulation Mode";

#if UNITY_EDITOR
        private static bool SimulationMode
        {
            get => ResMgr.SimulationMode;
            set => ResMgr.SimulationMode = value;
        }

        [MenuItem(SimulationModePath)]
        private static void ToggleSimulationMode()
        {
            SimulationMode = !SimulationMode;
        }

        // 通过利用 isValidateFunction 进行验证的时候，执行初始化操作
        [MenuItem(SimulationModePath, true)]
        private static bool ToggleSimulationModeValidate()
        {
            Menu.SetChecked(SimulationModePath, SimulationMode);
            return true;
        }
#endif
    }
}